package cn.gdsdxy.s02mybatis;


import cn.gdsdxy.s02mybatis.entity.Article;
import cn.gdsdxy.s02mybatis.repository.ArticleMapper2;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.List;

@SpringBootTest
public class ArticleTest2 {
    @Autowired
    ArticleMapper2 articleMapper2;

    @Test
    public void insertArticle(){
        Article article=new Article(10,"练习","Spring Boot练习");
        articleMapper2.insertArticle(article);
        System.out.println("新增元素的id值为："+article.getId());
    }

    @Test
    public void getAll(){
        List<Article> articles =articleMapper2.getAllArticle();
        System.out.println(articles);
    }
}
